﻿using System;
using System.Runtime.CompilerServices;
using Microsoft.Scripting.Runtime;

namespace Cjc.Calculation.ExpressionEngine.Excel.Runtime.Operations
{
	public static class DoubleOps
	{
		[ImplicitConversionMethod]
		public static decimal ConvertToDecimal( double x ) { return (decimal)x; }
		[ImplicitConversionMethod]
		public static string ConvertToString( int x ) { return x.ToString(); }

		[SpecialName]
		public static object Add( double x, double y ) { return DecimalOps.Add( (decimal)x, (decimal)y ); }
		[SpecialName]
		public static object Subtract( double x, double y ) { return DecimalOps.Subtract( (decimal)x, (decimal)y ); }
		[SpecialName]
		public static object Multiply( double x, double y ) { return DecimalOps.Multiply( (decimal)x, (decimal)y ); }
		[SpecialName]
		public static object Divide( double x, double y ) { return DecimalOps.Divide( (decimal)x, (decimal)y ); }

		[SpecialName]
		public static bool Equals( double x, double y ) { return ( x == y ); }
		[SpecialName]
		public static bool GreaterThan( double x, double y ) { return ( x > y ); }
		[SpecialName]
		public static bool GreaterThanOrEqual( double x, double y ) { return ( x >= y ); }
		[SpecialName]
		public static bool LessThan( double x, double y ) { return ( x < y ); }
		[SpecialName]
		public static bool LessThanOrEqual( double x, double y ) { return ( x <= y ); }
		[SpecialName]
		public static bool NotEquals( double x, double y ) { return ( x != y ); }
	}
}